home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #2
/
Monster Media No. 2 (Monster Media)(1994).ISO
/
prog_gen
/
gcoope10.zip
/
FILE.C
< prev
next >
Wrap
Text File
|
1994-07-21
|
907b
|
54 lines
/*
File object class definition for GCOOPE10
released as PUBLIC DOMAIN 4/25/94 ported and modified 7/21/94
*/
#define CLASS File
#include "gcoope10.h"
#include <stdio.h>
object CLASS;
extern object StdStream;
USEGEN(addressOf);
cmethod object m4New(object instance, const char * fnam, const char * mode)
{
if(NULL==makeInst(&instance)) return 0L;
g(New)(ST(StdStream), fopen(fnam, mode));
return instance;
}
cmethod object m4Kill(object instance)
{
FILE * handle;
handle=((VDPTRRV)g)(GEN(addressOf))(instance);
if(handle!=NULL)
{
fclose(handle);
}
g(Kill)(ST(StdStream));
g(Kill)(Object, instance);
return instance;
}
CLASS_INSTALL
{
if(END==(CLASS=g(New)(Class, 0, 0, StdStream, END))
|| addGMthd(CLASS, New, (method) m4New)
|| addGMthd(CLASS, Kill, (method) m4Kill)) return FUNCFAIL;
else return FUNCOKAY;
}